<template>
	<div>
		<el-tabs v-model="activeName" :stretch="flag" type="border-card" @tab-click="handleClick">
			<el-tab-pane label="套餐" name="first"><div Style="margin: 0 auto; width: 70%; height: 750px;"><mealInfo></mealInfo></div></el-tab-pane>
			<el-tab-pane label="专业套餐" name="second"><div Style="margin: 0 auto; width: 70%; height: 750px;"><majorMealInfo></majorMealInfo></div></el-tab-pane>
			<!-- <el-tab-pane label="公告通知" name="third"><div Style="margin: 0 auto; width: 70%; height: 750px;">公告通知</div></el-tab-pane> -->
			<el-tab-pane label="留言" name="third"><div Style="margin: 0 auto; width: 70%; height: 750px;"><bbsInfo></bbsInfo></div></el-tab-pane>
			<el-tab-pane label="信息总览" name="four"><div Style="margin: 0 auto; width: 70%; height: 750px;"><infoBrowse :bbsInfo="bbsInfo"></infoBrowse></div></el-tab-pane>
			<!-- 	<el-tab-pane label="定时任务补偿" name="fourth">定时任务补偿</el-tab-pane> -->
		</el-tabs>
	</div>
</template>

<script>
	import mealInfo from '@/components/meal_info/Meal_info.vue'
	import majorMealInfo from '@/components/major_meal_info/Major_meal_info.vue'
	import bbsInfo from '@/components/bbs_info/Bbs_info.vue'
	import infoBrowse from '@/components/fold_line/info_browse.vue'
	import {
		request
	} from "network/request.js"
	export default {
		name: 'Info_main',
		data: function() {
			return {
				activeName: 'first',
				flag:true,
				bbsInfo:0
			}
		},
		methods: {
			handleClick(tab, event) {
				 console.log(tab.name);
				 if(tab.name=='four'){
					 request({
					 	url: '/BbsInfo/BbsinfoAll',
					 	method: 'get'
					 }).then(res => {
					 		console.log(res.data)
					 		// console.log(this.bbsInfo)
					 	this.bbsInfo=res.data
						res.data=res.data.filter(item => item.bbsstage!='2' )
						let length1=res.data.length
						res.data=res.data.filter(item => item.bbsstage!='0' )
						let length2=res.data.length
						this.bbsInfo=Math.round((length2/length1)*100)
						// console.log(this.bbsInfo)
					 })					 
				 }
			}
		},
		components:{
			mealInfo,
			majorMealInfo,
			bbsInfo,
			infoBrowse
		}
	}
</script>

<style>
</style>
